﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Sparkle.Lib.Attributes
{
    /// <summary>
    /// Set x,y,height & width of control
    /// </summary>
    [AttributeUsage(AttributeTargets.Property)]
    public class VisualizationAttribute : Attribute
    {

        public VisualizationAttribute()
        { }

        public VisualizationAttribute(int height, int width)
        {
            _height = height;
            _width = width;
        }

        public VisualizationAttribute(bool visible)
        { _visible = visible; }

        private bool _readOnly = false;

        /// <summary>
        /// set readonly
        /// </summary>
        public bool ReadOnly
        {
            get { return _readOnly; }
            set { _readOnly = value; }
        }

        private bool _visible = true;

        /// <summary>
        /// set readonly
        /// </summary>
        public bool Visible
        {
            get { return _visible; }
            set { _visible = value; }
        }


        private bool _enable = true;

        public bool Enable
        {
            get { return _enable; }
            set { _enable = value; }
        }

        private bool _autoSize = true;

        public bool AutoSize
        {
            get { return _autoSize; }
            set
            {
                _autoSize = value;
                if (_autoSize == true)
                {
                    _height = 0; _width = 0;
                }

            }
        }



        #region LableAt

        private LabelLocation _labelAt = LabelLocation.Left;
        /// <summary>
        /// LableAt
        /// </summary>
        public LabelLocation LableAt
        {
            get { return _labelAt; }
            set { _labelAt = value; }
        }

        #endregion LableAt


        private bool _autoLocation = true;

        public bool AutoLocation
        {
            get { return _autoLocation; }
            set
            {
                _autoLocation = value;
                if (_autoLocation == true)
                {
                    _x = 0; _y = 0;
                    _row = 0; _col = 0;
                }
            }
        }



        private int _row = 0;

        /// <summary>
        /// X location
        /// </summary>
        public int Row
        {
            get { return _row; }
            set
            {
                _row = value;
                if (_row != 0)
                    _autoLocation = false;
            }
        }

        private int _col = 0;

        /// <summary>
        /// X location
        /// </summary>
        public int Col
        {
            get { return _col; }
            set
            {
                _col = value;
                if (_col != 0)
                    _autoLocation = false;
            }
        }



        private int _x = 0;

        /// <summary>
        /// X location
        /// </summary>
        public int X
        {
            get { return _x; }
            set
            {
                _x = value;
                if (_x != 0)
                    _autoLocation = false;
            }
        }

        private int _y = 0;

        /// <summary>
        /// Y location
        /// </summary>
        public int Y
        {
            get { return _y; }
            set
            {
                _y = value;
                if (_y != 0)
                    _autoLocation = false;
            }
        }


        private int _height = 0;

        /// <summary>
        /// height of control
        /// </summary>
        public int Height
        {
            get { return _height; }
            set
            {
                _height = value;
                if (_height != 0)
                    _autoSize = false;
            }
        }

        private int _width = 0;

        /// <summary>
        /// Width of control
        /// </summary>
        public int Width
        {
            get { return _width; }
            set
            {
                _width = value;
                if (_width != 0)
                    _autoSize = false;
            }
        }


        private bool _fullWidth = false;
        /// <summary>
        /// Set control full width this propery will ignore width 
        /// </summary>
        public bool FullWidth
        {
            get { return _fullWidth; }
            set { _fullWidth = value; _autoSize = false; }
        }
    }


}
